package com.inossem.warehousestorage_inossem.request.changeStorage.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.changeStorage.chuangyou.CYChangeStorageGetBatchRequestBean;
import com.inossem.warehousestorage_inossem.bean.changeStorage.chuangyou.CYChangeStorageMaterialBatchBean;
import com.inossem.warehousestorage_inossem.bean.outStorage.BatchBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * TODO
 *
 * @author 王斯宇
 * @time on 2018/3/30 11:09
 * @email siyu.wang@inossem.com
 */
public class CYChangeStorageMaterialBatchRequest extends Request {

    public static String request(Context context, CYChangeStorageGetBatchRequestBean bean , GsonBeanListener gsonBeanListener) {
        String tag;
        Gson gson = new Gson();
        String params = gson.toJson(bean , CYChangeStorageGetBatchRequestBean.class);
        String methodUrl = RequestManage.getUrl(context , RequestConstant.CY_URL_CHANGE_STORAGE_GET_MATERIAL_BATCH);
        tag = RequestManage.getHttpsPostWithLoading(context, methodUrl, params ,new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                BatchBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), BatchBean.class);
                excuteJsonBeanNew(context, bean,gsonBeanListener);
            }
        });
        return tag;
    }
}
